<template>
  <div>
    <div class="head">
      <a @click="$router.push({path: '/MyProject'})" class="return"></a>
      {{$t('MoneyDetails.v1')}}
    </div>
    <div class="overlay">
      <div class="overlay-content scrolling" style="padding-top: 10px;">
        <van-pull-refresh v-model="isLoading" @refresh="onRefresh" pulling-text=" " :loosing-text="$t('MyTeam.v8')"
                          :loading-text="$t('MyTeam.v7')">
            <div style="background: white;color: black;text-align: center;padding: 10px 0px;margin-bottom: 10px;" v-for="(item,index) in list" :key="item.index">
              <van-row>
                <van-col span="8">{{$t('MoneyDetails.v3')}}</van-col>
                <van-col span="8">{{$t('MoneyDetails.v4')}}</van-col>
                <van-col span="8">{{$t('MoneyDetails.v2')}}</van-col>
              </van-row>
              <van-row style="color: rgb(125, 126, 128);font-size: 13px;padding-top: 5px;">
                <van-col span="8">{{item.total}}</van-col>
                <van-col span="8">{{parseFloat(Number(item.ratio * 100)).toFixed(3).slice(0,-1)}} %</van-col>
                <van-col span="8">{{item.createTime | dateFormat}}</van-col>
              </van-row>
            </div>
          <div style="color: #969799;font-size: 13px;line-height: 50px;text-align: center">{{$t('MyTeam.v5')}}</div>
        </van-pull-refresh>
      </div>
    </div>
  </div>
</template>

<script>
    import {crowdfunding} from './../../utils/api';
    import {dateFormat} from 'vux';

    export default {
        name: "MoneyDetails",
        data() {
            return {
                list: [],
                isLoading: false
            }
        },
        mounted() {
            this.getList();
        },
        methods: {
            getList() {
                crowdfunding.getParticipate({
                    projectId: this.$route.query.projectId,
                }).then(res => {
                    if (res.code == 200) {
                        this.list = res.data;
                    }
                })
            },
            onRefresh() { // 下拉刷新
                this.getList();
                setTimeout(() => {
                    this.$toast({
                        duration: 800,
                        message: this.$t('Prize.v23')
                    });
                    this.isLoading = false;
                }, 500);
            }
        },
        filters: {
            dateFormat
        }
    }
</script>

<style lang="less" scoped>
  .overlay {
    background: rgb(245, 245, 245);
  }

  .head {
    background: white;
    color: black;
  }

  .head .return:after {
    border-color: black;
  }
</style>
